package com.wzcl.app.controller;

import com.wzcl.app.model.common.RVO;
import com.wzcl.app.model.dto.WorkShowReviewsDto;
import com.wzcl.app.service.WorkShowReviewsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author beingven
 * @Description 作品秀点评controller
 * @createTime 2021年01月12日 17:47:00
 */
@RestController
@RequestMapping("/reviews")
@Api(value = "作品秀点评controller", tags = {"作品秀点评相关接口"})
public class WorkShowReviewsController {
    @Resource
    private WorkShowReviewsService workShowReviewsService;

    @ApiOperation("新增评论")
    @PostMapping("/create")
    public RVO createReviews(@RequestBody @Valid WorkShowReviewsDto workShowReviewsDto){
        return RVO.success(workShowReviewsService.createReviews(workShowReviewsDto));
    }

    @ApiOperation("根据id删除评论")
    @DeleteMapping("/delete/{id}")
    public RVO deleteReviewsById(@PathVariable Integer id){
        return workShowReviewsService.deleteReviewsById(id);
    }

    @ApiOperation("根据id查询评论")
    @GetMapping("/retrieve/{id}")
    public RVO retrieveById(@PathVariable Integer id){
        return workShowReviewsService.retrieveById(id);
    }
}